package com.share.common.enums;

// 平台枚举
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

/**
 * 平台标识
 */
@Getter
public enum SocialPlatformEnum {
    SYSTEM(1, "System", "系统"),
    WECHAT(2, "WeChat", "微信"),
    GITE(3, "Gite", "码云"),
    GITHUB(4, "GitHub", "GitHub");


    @EnumValue // 标记存储到数据库的值
    private final Integer code;
    private final String value;
    private final String desc;

    SocialPlatformEnum(Integer code, String value, String desc) {
        this.code = code;
        this.value = value;
        this.desc = desc;
    }

    // 可选：根据code获取枚举
    public static SocialPlatformEnum getByCode(Integer code) {
        for (SocialPlatformEnum platform : values()) {
            if (platform.getCode().equals(code)) {
                return platform;
            }
        }
        return null;
    }
}